//
//  Core.h
//  My1A2B
//
//  Created by sun ives on 2009/12/29.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#define LIMIT 100
typedef struct strGuess{
	int no;
	char number[LIMIT];
	char result[LIMIT];
}strGuess;
typedef struct strSummary{
	int count;
}strSummary;
typedef struct strGame{
	int no;
	int count;
	char *answer;
	char *startTime;
	char *guessTime;
	strGuess guess[LIMIT];
	struct strGame *next;
}strGame;

@interface Core : NSObject {	
	char *m_answer;
	time_t m_startTime, m_stopTime;
	int m_playTime, m_playTimeMinute, m_playTimeSecond;
	char* m_playTimeText;
	strSummary m_summary;
	strGame *m_gameHead, *m_gameCurr;
	int m_gameCount, m_guessCount, m_answerCount;
	bool m_newRecord;
}

- (id) init;
- (void)reStart:(int)count;
- (void) makeAnswer;
- (bool) checkDup:(int)n;
- (char *) getAnswer;
- (int) getAnswerCount;
- (int) getGuessCount;
- (char *)getPlayTimeText;
- (int)getPlayTimeMinute;
- (int)getPlayTimeSecond;
- (strGame *)getGameFromNO:(int)no;
- (char *) compare:(char *)number;
- (void)formatTime:(int)second;
- (strGame *)setGame:(int)no count:(int)count answer:(char*)answer startTime:(char*)startTime guessTime:(char*)guessTime guess:(strGuess*)guess;
- (void)setSummaryCount:(int)count;
- (strSummary)getSummary;
- (strGame *)getGameHead;
- (void) plusGameCount;
- (void) plusGuessCount;
- (void) plusSummaryCount;
- (bool) isNewRecord;
- (void) setNewRecordFalse;

- (void) destroy1;
- (void) destroy;

@end
